#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char const *argv[])
{
        //先切换工作目录
        chdir("bbb");

        int fd = open("temp", O_WRONLY | O_CREAT, 0666);
        write(fd, "daociyiyou", 10);
        close(fd);
        //显示当前工作目录
        char buf[256];
        getcwd(buf, sizeof(buf));

        printf("buf is [%s]\n", buf);
        return 0;
}
